package cn.lxb.web.starter.template.autoconfigure.jackson.deserializer;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;

import java.io.IOException;
import java.time.Year;

/**
 * 年份反序列化处理
 *
 * @author 54lxb
 * @since 2019-11-20
 *
 */
public class YearDeserializer extends JsonDeserializer<Year> {

    @Override
    public Year deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
        return Year.of(jp.getValueAsInt());
    }
}